/*************************************************************************
 * ICommand is the abstract of the command send to the dash board.
 * you can use the interface ICommand as the test program said to
 * you.if you want expand the function of the ICommand,you can inherit
 * the ICommand interface.
 * The author:Zhang YongChang
 * The Date:2012-2-20
 * CopyRight @ robot loving team.
 ***********************************************************************/
#ifndef COMMAND_H
#define COMMAND_H

#include <vector>

namespace robot {
/**
 * This is the interface of the command.
 */
class ICommand {
public:
	ICommand();
	virtual ~ICommand();

	//use this interface change the command to string.
	virtual void ToString(char *buf) = 0;
};
/**
 * This is the define of the common command.
 */
class Command: public ICommand {
public:
	Command(int id, int angle, int times);
	virtual ~Command();

	int GetID() const {
		return m_ID;
	}
	int GetAngle() const {
		return m_angle;
	}
	int GetTimes() const {
		return m_times;
	}

	virtual void ToString(char *buf);
private:
	int m_ID; //define the id of the command.
	int m_angle; //define the angle of the command.
	int m_times; //define the time use to rotate.
};

/**
 * This is the set of the command set.
 */
class CommandSet: public ICommand {
public:
	CommandSet();
	virtual ~CommandSet();

	virtual void ToString(char *buf);

	virtual void AddCommand(const Command &command);
private:
	std::vector<int> m_ID_Set; //define the set of the id.
	std::vector<int> m_Angle_Set; //define the set of angle.
	std::vector<int> m_Times_Set; //define the times set use to rotate.

};

/**
 * This is the define of command group.
 */
class CommandGroup: public ICommand {
public:
	CommandGroup(const std::vector<int> &group_id, int times);
	virtual ~CommandGroup();

	virtual void ToString(char *buf);

private:
	std::vector<int> m_group_id; //define the command group id.
	int m_times; //define the time to rotate.
};

void itoa(unsigned long val, char *buf, unsigned radix);
}

#endif

